{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- 温馨提示 -->
		{{if is_array(MyLang('power.top_tips_list'))}}
			<div class="am-alert am-alert-danger" data-am-alert>
				<button type="button" class="am-close">&times;</button>
				<p>{{:implode('</p><p>', MyLang('power.top_tips_list'))}}</p>
			</div>
		{{/if}}

		<!-- operation start -->
		<div class="am-g">
			<button class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus submit-add"> {{:MyLang('add_title')}}</button>
		</div>
		<!-- operation end -->

		<!-- save win start -->
		<div class="am-popup am-radius" id="power-save-win">
			<div class="am-popup-inner">
				<div class="am-popup-hd">
					<h4 class="am-popup-title" data-add-title="{{:MyLang('power.base_nav_title')}}{{:MyLang('add_title')}}" data-edit-title="{{:MyLang('power.base_nav_title')}}{{:MyLang('edit_title')}}">{{:MyLang('power.base_nav_title')}}{{:MyLang('add_title')}}</h4>
					<span data-am-modal-close class="am-close">&times;</span>
				</div>
				<div class="am-popup-bd">
					<!-- form start -->
					<form class="am-form form-validation am-form-full-screen am-form-popup-fixed" action="{{:MyUrl('admin/power/save')}}" method="POST" request-type="ajax-reload">
						{{if is_array(MyLang('power.content_top_tips_list'))}}
							<div class="am-alert am-alert-warning" data-am-alert>
								<button type="button" class="am-close">&times;</button>
								<p>{{:implode('</p><p>', MyLang('power.content_top_tips_list'))}}</p>
							</div>
						{{/if}}

						<div class="am-cf">
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				<div class="am-form-group">
									<label>{{:MyLang('common_service.power.form_item_pid')}}</label>
									<select class="am-radius chosen-select" name="pid" data-placeholder="{{:MyLang('common_service.power.form_item_pid_placeholder')}}" data-validation-message="{{:MyLang('common_service.power.form_item_pid')}}">
										<option value="0">{{:MyLang('common_service.power.form_item_pid_placeholder')}}</option>
										{{foreach $data as $v}}
											<option value="{{$v.id}}">{{$v.name}}</option>
										{{/foreach}}
									</select>
								</div>
                			</div>
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				<div class="am-form-group">
									<label>{{:MyLang('common_service.power.form_item_name')}}<span class="am-form-group-label-tips-must">*</span></label>
									<input type="text" placeholder="{{:MyLang('common_service.power.form_item_name_message')}}" name="name" minlength="1" maxlength="60" data-validation-message="{{:MyLang('common_service.power.form_item_name_message')}}" class="am-radius" required />
								</div>
                			</div>
                		</div>

                		<div class="am-cf">
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				<div class="am-form-group">
									<label>{{:MyLang('common_service.power.form_item_control')}}</label>
									<input type="text" placeholder="{{:MyLang('common_service.power.form_item_control_message')}}" name="control" pattern="{{:MyConst('common_regex_control')}}"  data-validation-message="{{:MyLang('common_service.power.form_item_control_message')}}" class="am-radius" />
								</div>
                			</div>
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				<div class="am-form-group">
									<label>{{:MyLang('common_service.power.form_item_action')}}</label>
									<input type="text" placeholder="{{:MyLang('common_service.power.form_item_action_message')}}" name="action" pattern="{{:MyConst('common_regex_action')}}"  data-validation-message="{{:MyLang('common_service.power.form_item_action_message')}}" class="am-radius" />
								</div>
                			</div>
                		</div>

                		<div class="am-cf">
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				<div class="am-form-group">
									<label>{{:MyLang('common_service.power.form_item_url')}}</label>
									<input type="url" name="url" placeholder="{{:MyLang('common_service.power.form_item_url_message')}}" data-validation-message="{{:MyLang('common_service.power.form_item_url_message')}}" class="am-radius" />
								</div>
                			</div>
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				<div class="am-form-group">
									<label>{{:MyLang('common_service.power.form_item_icon')}}{{if is_array(MyLang('common_service.power.form_item_icon_tips_list'))}}<a href="javascript:;" class="am-icon-question-circle am-text-warning am-margin-left-sm" data-am-popover="{content: '{{:implode('<br />', MyLang('common_service.power.form_item_icon_tips_list'))}}', trigger: 'hover focus', theme: 'sm'}"></a>{{/if}}</label>
									<input type="text" placeholder="{{:MyLang('common_service.power.form_item_icon_message')}}" name="icon" maxlength="60" data-validation-message="{{:MyLang('common_service.power.form_item_icon_message')}}" class="am-radius" />
								</div>
                			</div>
                		</div>

                		<div class="am-cf">
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				{{include file="lib/sort" /}}
                			</div>
                			<div class="am-u-sm-6 am-padding-horizontal-0">
                				{{include file="lib/is_show" /}}
                			</div>
                		</div>

						<div class="am-form-popup-submit">
							<input type="hidden" name="id" />
							<button type="button" class="am-btn am-btn-warning am-radius am-btn-xs btn-loading-example am-margin-right-lg" data-am-modal-close>
                                <i class="am-icon-paint-brush"></i>
                                <span>{{:MyLang('cancel_title')}}</span>
                            </button>
                            <button type="submit" class="am-btn am-btn-primary am-radius am-btn-xs btn-loading-example" data-am-loading="{spinner: 'circle-o-notch', loadingText:'{{:MyLang('save_title')}}'}">
                                <i class="am-icon-save"></i>
                                <span>{{:MyLang('save_title')}}</span>
                            </button>
						</div>
					</form>
					<!-- form end -->
				</div>
			</div>
		</div>
		<!-- save win end -->

        <!-- content start -->
        <div class="am-padding-vertical-sm">
			<ul class="tree-list am-padding-left-0">
				{{foreach $data as $v}}
					<li id="data-list-{{$v.id}}">
						<div class="item-content am-padding-sm am-margin-bottom-xs am-margin-right-xs {{if $v['is_show'] eq 0}}bk-cr-ffd{{/if}}">
							{{if !empty($v['item'])}}
								<i class="stretch am-icon-plus am-margin-right-xs"></i>
							{{/if}}
							<span>{{if !empty($v['icon'])}}<span class="iconfont {{$v.icon}}"></span>{{/if}} {{$v.name}}</span>
							<span class="am-margin-left-sm">
								<a href="javascript:;" class="am-icon-edit submit-edit" data-json='{{:json_encode($v)}}' data-tag="power-save-win" data-item="{{if !empty($v['item'])}}ok{{else /}}no{{/if}}"></a>
								{{if empty($v['item'])}}
									<a href="javascript:;" class="am-icon-trash-o am-padding-left-sm submit-delete" data-url="{{:MyUrl('admin/power/delete')}}" data-id="{{$v.id}}"></a>
								{{/if}}
							</span>
						</div>
					</li>
					{{if !empty($v['item'])}}
						<ul class="list-find am-avg-sm-2 am-avg-md-3 am-avg-lg-4 am-margin-top-xs am-margin-left-xl" style="display:none;">
							{{foreach $v.item as $vs}}
								<li id="data-list-{{$vs.id}}">
									<div class="item-content am-padding-sm am-margin-bottom-xs am-margin-right-xs {{if $vs['is_show'] eq 0}}bk-cr-ffd{{/if}}">
										<span>{{if !empty($vs['icon'])}}<span class="iconfont {{$vs.icon}}"></span>{{/if}} {{$vs.name}}</span>
										<span class="am-fr find-submit">
											<a href="javascript:;" class="am-icon-edit submit-edit" data-json='{{:json_encode($vs)}}' data-tag="power-save-win" data-item="no"></a>
											<a href="javascript:;" class="am-icon-trash-o am-margin-left-sm submit-delete" data-url="{{:MyUrl('admin/power/delete')}}" data-id="{{$vs.id}}"></a>
										</span>
									</div>
								</li>
							{{/foreach}}
						</ul>
					{{/if}}
				{{/foreach}}
			</ul>
		</div>
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->